package com.company.cloud.userdata.modules.app.controller;


import com.company.cloud.common.auth.annotation.Login;
import com.company.cloud.common.bean.BaseResult;
import com.company.cloud.common.bean.LoginSimpleUserInfo;
import com.company.cloud.common.utils.AuthContextUtils;
import com.company.cloud.userdata.modules.app.controller.req.BrokerDataStatisticsModel;
import com.company.cloud.userdata.modules.app.controller.req.UserDataStatisticsModel;
import com.company.cloud.userdata.modules.app.service.UserDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Log4j2
@Login
@RestController
@RequestMapping("/app/data/userData")
@Api(tags="UserData_App_用户统计数据服务")
public class UserDataController {



    @Autowired
    private UserDataService userDataService;


    @GetMapping("/getUserDataStatistics")
    @ApiOperation(value="用户统计数据", response=UserDataStatisticsModel.class)
    public BaseResult getUserDataStatistics() {
        LoginSimpleUserInfo user = AuthContextUtils.getUser();
        UserDataStatisticsModel data=userDataService.getUserDataStatistics(user.getId());
        return BaseResult.ok(data);
    }


    @GetMapping("/getBrokerDataStatistics")
    @ApiOperation(value="经纪人统计数据", response= BrokerDataStatisticsModel.class)
    public BaseResult getBrokerDataStatistics() {
        LoginSimpleUserInfo user = AuthContextUtils.getUser();
        BrokerDataStatisticsModel data = userDataService.getBrokerDataStatistics(user.getId());
        return BaseResult.ok(data);
    }



}
